package com.mingqijia.gassafety.webserver.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.gap.basic.base.CommonResponse;
import com.mingqijia.gassafety.db.entity.FuncArea;
import com.mingqijia.gassafety.webserver.dto.AdInfoDTO;
import com.mingqijia.gassafety.webserver.request.BusinessAreaListRequest;
import com.mingqijia.gassafety.webserver.request.FuncAreaAddRequest;
import com.mingqijia.gassafety.webserver.request.FuncAreaEditRequest;
import com.mingqijia.gassafety.webserver.request.FuncAreaQueryRequest;
import com.mingqijia.gassafety.webserver.response.*;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @Author: duanhongxiang
 * @Date: 2024/6/13 21:27
 */
public interface FunctionAreaService extends IService<FuncArea> {
    /**
     * 区,街道树形列表
     * @return
     */
    List<FuncAreaTreeResponse> treeList();

    /**
     * 区,街道，商圈树形列表
     * @return
     */
    List<FuncAreaListResponse> List(FuncAreaQueryRequest request);

    /**
     * @Method selectList
     * @Author zm
     * @Description selectList
     * @Date 2024/7/12 14:45
    */
    List<FuncAreaDetailResponse> selectList(Integer level);

    /**
     * @Method add
     * @Author zm
     * @Description add
     * @Date 2024/7/9 15:40
    */
    @Transactional(rollbackFor = Exception.class)
    CommonResponse<Boolean> add(FuncAreaAddRequest req);

    /**
     * @Method edit
     * @Author zm
     * @Description edit
     * @Date 2024/7/9 15:40
    */
    @Transactional(rollbackFor = Exception.class)
    CommonResponse<Boolean> edit(FuncAreaEditRequest req);

    /**
     * @Method detail
     * @Author zm
     * @Description detail
     * @Date 2024/7/9 15:47
    */
    CommonResponse<FuncAreaDetailResponse> detail(Integer id);

    /**
     * @Method detail
     * @Author zm
     * @Description detail
     * @Date 2024/7/9 15:47
     */
    @Transactional(rollbackFor = Exception.class)
    CommonResponse<Boolean> delete(Integer id);

  /**
   * @Method relationInfo
   * @Author zm
   * @Description relationInfo
   * @Date 2024/7/11 9:22
  */
    CommonResponse<FuncAreaRelationInfoResponse> relationInfo(Integer id);

    /**
     * @Method parentAndPeerInfo
     * @Author zm
     * @Description parentAndPeerInfo
     * @Date 2024/7/9 15:47
    */
    CommonResponse<FuncAreaParentAndPeerInfoResponse> parentAndPeerInfo(Integer pid);

    /**
     * @Method parentAndPeerInfo
     * @Author zm
     * @Description parentAndPeerInfo
     * @Date 2024/7/9 15:47
     */
    CommonResponse<FuncAreaPeerInfoListResponse> maxOrdinal(Integer level);

    /**
     * 商圈列表
     * @param request
     * @return
     */
    List<BusinessAreaItemResponse> businessAreaList(BusinessAreaListRequest request);

    /**
     * 获取功能区map
     * @return
     */
    Map<String, AdInfoDTO> getFuncAreaMapByCode();

    /**
     * 获取功能区map
     * @return
     */
    Map<String,FuncArea> getFuncAreaMapByCode(Integer level);

    /**
     * 获取功能区map
     * @param level
     * @return
     */
    Map<Integer,FuncArea> getFuncAreaMapById(Integer level);

    /**
     * 获取功能区map key为功能区名称
     * @return
     */
    Map<String, FuncArea> getFuncAreaMapByName();

    /**
     * 获取层级
     * @return
     */
    List<FuncAreaLevelResponse> getLevels();

    /**
     * 同步区域
     */
    void syncArea();
}
